<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    String[] cartItems = (String[]) session.getAttribute("cart");
    int totalPrice = 0;
    if (cartItems != null) {
        for (String item : cartItems) {
            int price = 0;
            switch (item) {
                case "1":
                    price = 99;
                    break;
                case "2":
                    price = 49;
                    break;
                case "3":
                    price = 29;
                    break;
            }
            totalPrice += price;
        }
    }
    session.setAttribute("totalPrice", totalPrice);
    response.sendRedirect("shop.jsp");
%>